import Page.basepage
from  appium.webdriver.common import  mobileby


class Login(Page.basepage.Basepage):
    by = mobileby.MobileBy()
    #跳转
    # jp =(by.ID,"com.tpson.logisticsscanner.app:id/iv_next")
    #选择账号密码登录
    # tab =(by.ID,"com.tpson.logisticsscanner.app:id/tv_way")
    #账号输入框
    user =(by.ID,"com.tpson.firecontrolv3:id/et_user_name")

    #密码输入框
    password =(by.ID,"com.tpson.firecontrolv3:id/et_password")
    #登录按钮
    user_button =(by.ID,"com.tpson.logisticsscanner.app:id/btn_login")
    #点击设置url
    mine_button =(by.ID,"com.tpson.firecontrolv3:id/tv_setting_ip")
    #清空url默认值
    outinput =(by.ID,"com.tpson.firecontrolv3:id/et_url")
    # 写入url http://192.168.0.214:8884/
    send_url = (by.ID,"com.tpson.firecontrolv3:id/et_url")
    #点击确定按钮
    click = (by.ID,"android:id/button1")
    # 点击登录
    btn_login = (by.ID,"com.tpson.firecontrolv3:id/btn_login")
    #点击跳转
    def click_jp(self):
        self.find_element(*self.jp).click()

    def click_tab(self):
        self.find_element(*self.tab).click()

    def input_user(self,username):
        self.send_keys(username,*self.user)


    def input_password(self,password):
        self.send_keys(password,*self.password)

    def click_user_button(self):
        self.find_element(*self.user_button).click()

    def click_mine_button(self):
        self.find_element(*self.mine_button).click()

    def click_outinput(self):
        self.find_element(*self.outinput).click()
